package com.winit.cloudlink.mgmt.task;

import com.google.common.collect.Maps;

import java.util.Map;

public class SimpleTaskHandlerRegistry implements TaskHandlerRegistry {
    private Map<String, TaskHandler> taskHandlers = Maps.newConcurrentMap();

    @Override
    public void register(TaskHandler taskHandler) {
        taskHandlers.put(taskHandler.taskType(), taskHandler);
    }

    @Override
    public void unregister(String taskType) {
        taskHandlers.remove(taskType);
    }

    @Override
    public TaskHandler lookup(String taskType) {
        return taskHandlers.get(taskType);
    }
}
